package com.killer.user.controller;


import com.killer.common.entity.Result;
import com.killer.user.entity.Address;
import com.killer.user.service.IAddressService;
import com.killer.user.util.TokenUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.killer.db.controller.BaseController;

import java.util.List;

/**
 * <p>
 * 地址表 前端控制器
 * </p>
 *
 * @author killer
 * @since 2021-11-06
 */
@RestController
@RequestMapping("/address")
public class AddressController extends BaseController<IAddressService, Address> {

    @GetMapping("/listUserAddress")
    public Result listUserAddress(){
        Long userId = TokenUtil.getCurrentUserId();
        List<Address> addressList = baseService.listAddressByUserId(userId);
        return Result.success(addressList);
    }

}
